package com.chen.entity;

import lombok.Data;
import lombok.ToString;

import java.util.ArrayList;
import java.util.List;

@Data
@ToString
public class Klass {
    private String name;
    private List<Student> students;

    public Klass(String name){
        this.name = name;
        this.students = new ArrayList<>();
    }

    //增加一个学生
    public void addStudent(Student student){
        if (students == null){
            students = new ArrayList<>();
        }
        students.add(student);
    }
}
